Repository navigation
Speed up inherited-time check in testRequiredTime - #12
Merged
rob-metalinkage merged 1 commit intoOct 28, 2026
Merged
rob-metalinkage merged 1 commit into
rob-metalinkage merged 1 commit into
Conversation
Bind ?path (resultTime/phenomenonTime) before matching the collection's triples instead of filtering it afterwards. With ?path unbound, rdflib enumerated every property of the collection (e.g. all geojson:features links) and ran the "nearer collection" NOT EXISTS test for each row before the filter removed them: ~5s per observation on a 1168-feature CSD (40 min for 486 observations), now ~0.03s. VALUES would be simpler but is not allowed in SHACL-SPARQL constraints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The second SPARQL constraint of
testRequiredTime(at most oneresultTime/phenomenonTime, possibly inherited from the nearest collection) is very slow on large collections.In the inherited-value branch,
?holder ... ; ?path ?timewas matched with?pathunbound and only narrowed byFILTER(?path IN (...))afterwards. rdflib therefore enumerated every property of the collection, e.g. everygeojson:featureslink, and ran the "nearer collection"FILTER NOT EXISTStest for each row before the filter discarded them.This change binds
?pathfirst with{ BIND(sosa:resultTime AS ?path) } UNION { BIND(sosa:phenomenonTime AS ?path) }. (VALUESwould be simpler but is not allowed in SHACL-SPARQL constraints; pyshacl rejects it.) The query semantics are unchanged.Impact (measured on a 3D-CSDM cadastral survey with 1168 features and 486 observations):
execution/shapes.shaclvalidation of that dataset: >15 min → 23.5 sTesting: local build of this register: 47/47 building blocks pass, and every SHACL/schema test gives the same result as the current CI build, including
collection-time-ambiguous-inherited-fail(exercises this branch) andcollection-time-nearest-inherited(the nearer-collection exemption).🤖 Generated with Claude Code